# Copyright (C) 2018 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#      http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

load("@io_bazel_rules_go//proto:def.bzl", "go_proto_library")
load("@io_bazel_rules_go//go:def.bzl", "go_library", "go_test")

go_library(
    name = "go_default_library",
    srcs = [
        "capture.go",
        "context.go",
        "decoder.go",
        "doc.go",
        "encoder.go",
        "graphics.go",
        "perfetto.go",
    ],
    embed = [":capture_go_proto"],
    importpath = "github.com/google/gapid/gapis/capture",
    visibility = ["//visibility:public"],
    deps = [
        "//core/app/analytics:go_default_library",
        "//core/app/status:go_default_library",
        "//core/context/keys:go_default_library",
        "//core/data/id:go_default_library",
        "//core/data/pack:go_default_library",
        "//core/data/protoconv:go_default_library",
        "//core/log:go_default_library",
        "//core/math/interval:go_default_library",
        "//core/memory/arena:go_default_library",
        "//gapis/api:go_default_library",
        "//gapis/database:go_default_library",
        "//gapis/memory:go_default_library",
        "//gapis/messages:go_default_library",
        "//gapis/perfetto:go_default_library",
        "//gapis/replay/value:go_default_library",
        "//gapis/service:go_default_library",
        "//gapis/service/path:go_default_library",
        "@com_github_golang_protobuf//proto:go_default_library",
        "@com_github_pkg_errors//:go_default_library",
    ],
)

proto_library(
    name = "capture_proto",
    srcs = ["capture.proto"],
    visibility = ["//visibility:public"],
    deps = ["//core/os/device:device_proto"],
)

cc_proto_library(
    name = "capture_cc_proto",
    visibility = ["//visibility:public"],
    deps = [":capture_proto"],
)

go_proto_library(
    name = "capture_go_proto",
    importpath = "github.com/google/gapid/gapis/capture",
    proto = ":capture_proto",
    visibility = ["//visibility:public"],
    deps = ["//core/os/device:go_default_library"],
)

go_test(
    name = "go_default_test",
    srcs = ["capture_test.go"],
    embed = [":go_default_library"],
    deps = [
        "//core/assert:go_default_library",
        "//core/log:go_default_library",
        "//core/memory/arena:go_default_library",
        "//core/os/device:go_default_library",
        "//gapis/api:go_default_library",
        "//gapis/api/test:go_default_library",
        "//gapis/database:go_default_library",
    ],
)
